package com.twu.biblioteca;

public class Book {

    private String title, author, subject_area;
    private Integer ISBN_Number;
    private int ZERO_VALUE = 0;
    private int copies_available;

    public Book(String title, String author, String subject_area, Integer ISBN_Number, int copies_available) throws Exception{
        this.title = title;
        this.author = author;
        this.subject_area = subject_area;
        this.ISBN_Number = ISBN_Number;
        this.copies_available = copies_available;

        if(checkBookValid()){
            throw new Exception("Invalid book values entered!");
        }
    }

    private boolean checkBookValid() {
        return title.matches(" ") || author.matches(" ") || subject_area.matches(" ") || ISBN_Number == ZERO_VALUE;
    }

    public Integer getISBN_Number() {
        return ISBN_Number;
    }

    public String getTitle() {
        return title;
    }

    public String getAuthor() {
        return author;
    }

    public String getSubjectArea() {
        return subject_area;
    }

    public int getCopies() {
        return copies_available;
    }
}
